<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link type="text/css" rel="stylesheet"
          href="<%=basePath%>statics/js/plug/selectator-master/fm.selectator.jquery.css"/>
    <link type="text/css" rel="stylesheet" href="<%=basePath %>statics/css/common/common-1.0.css">
    <link type="text/css" rel="stylesheet" href="<%=basePath %>statics/js/plug/jqueryUI/jquery-ui.css">
    <link type="text/css" rel="stylesheet" href="<%=basePath %>statics/js/plug/jqPaginator/jqPaginator.css"/>
    <link type="text/css" rel="stylesheet" href="<%=basePath %>statics/css/base/baseuser/base_user.css">
    <link type="text/css" rel="stylesheet" href="<%=basePath %>statics/js/plug/jbox/jBox.css">
    <script type="text/javascript" src="<%=basePath %>statics/js/plug/jquery-1.12.0.min.js"></script>
    <script type="text/javascript" src="<%=basePath %>statics/js/plug/jbox/jBox.js"></script>
    <script type="text/javascript" src="<%=basePath %>statics/js/common/common-1.0.js"></script>
    <script type="text/javascript" src="<%=basePath %>statics/js/common/loading.js"></script>
    <script type="text/javascript" src="<%=basePath %>statics/js/plug/jqueryUI/jquery-ui.js"></script>
    <script type="text/javascript" src="<%=basePath %>statics/js/base/baseuser/base_user_list.js"></script>
    <script type="text/javascript" src="<%=basePath %>statics/js/plug/jqPaginator/jqPaginator.js"></script>
    <script type="text/javascript">
        var pageNumber = ${page.pageNumber};
        var totalCount = ${page.totalCount};
        var pageSize = ${page.pageSize};
    </script>
    <title>用户列表</title>
</head>
<body>
<div class="window-title-bar">
    <h5 class="title">用户管理</h5>
    <div class="nav">
        <span class="prev-nav">系统管理</span>
        <span class="space">/</span>
        <span class="cur-nav">用户管理</span>
    </div>
</div>
<div class="grid-toolbar">
    <form id="searchForm" method="post">
        <input id="isFilter" type="hidden" name="isFilter" value="${isFilter}">
        <div class="grid-search-item">
            <span class="label">用户名:</span>
            <input type="text" class="input-search" id="userName" name="userName" value="${baseUser.suerName}" placeholder="用户名">
            <button id="searchBtn" type="button" class="btn-icon btn-search"></button>
        </div>
        <!--<div class="grid-search-item">
            <span class="label">用户名:</span>
            <input type="text">
        </div>-->
    </form>
</div>

<shiro:hasPermission name="BaseUser:view">
    <div class="grid-list">
        <table class="grid-action" cellpadding="0" cellspacing="0">
            <tr>
                <td class="title">
                    结果列表
                </td>
                <td class="action">
                    <ul>
                        <shiro:hasPermission name="BaseUser:create">
                            <li>
                                <button id="addBtn" type="button" class="btn-add">添加</button>
                            </li>
                        </shiro:hasPermission>
                        <shiro:hasPermission name="BaseUser:delete">
                            <li>
                                <button id="deleteBtn" type="button" class="btn-delete">删除</button>
                            </li>
                        </shiro:hasPermission>
                        <li>
                            <button id="refreshCacheBtn" type="button" class="btn-icon btn-refresh">刷新缓存</button>
                        </li>
                    </ul>
                </td>
            </tr>
        </table>
        <table id="userTable" class="list" cellspacing='0' cellpadding="0" width='100%'>
            <tr>
                <th width="50px">
                    <span class="checkbox" id="checkAll"></span></th>
                <th width="30px">序号</th>
                <th width="90px">用户名</th>
                <th width="90px">别名</th>
                <th width="40px">性别</th>
                <th width="100px">出生日期</th>
                <th width="150px">部门</th>
                <th>角色列表</th>
                <th width="200px">操作</th>
            </tr>
            <c:forEach var="user" items="${page.items}" varStatus="status">
                <tr>
                    <td><span id="${user.id}" class="checkbox"></span></td>
                    <td>${status.count}</td>
                    <td>${user.userName == null ? "&nbsp;" : user.userName}</td>
                    <td>${user.nickname == null ? "&nbsp;" : user.nickname}</td>
                    <td>${user.sex == 1 ? "男" : "女"}</td>
                    <td>
                        <fmt:formatDate pattern="yyyy-MM-dd" value="${user.birthday}"/>
                    </td>
                    <td>${user.deptName == null ? "&nbsp;" : user.deptName}</td>
                    <td>${user.roleName}</td>
                    <td>
                        <ul class="grid-list-action">
                            <shiro:hasPermission name="BaseUser:update">
                                <li>
                                    <button class="btn-edit" title="编辑"
                                            onclick="gridDataEdit('base/user/edit/${user.id}',{dialogId:'dialog'})">编辑</button>
                                </li>
                            </shiro:hasPermission>
                            <shiro:hasPermission name="BaseUser:update">
                                <li>
                                    <button class="btn-icon btn-setting" title="配置"
                                            onclick="gridDataEdit('app/authority/add/${user.id}',{dialogId:'dialog'})">配置</button>
                                </li>
                            </shiro:hasPermission>
                            <shiro:hasPermission name="BaseUser:delete">
                                <li>
                                    <button class="btn-delete" title="删除"
                                            onclick="gridDataDelete('base/user/delete/${user.id}',{successUrl:'base/user/list/1/${page.pageSize}'})">删除</button>
                                </li>
                            </shiro:hasPermission>
                        </ul>
                    </td>
                </tr>
            </c:forEach>
            <c:if test="${lastCount > 0}">
                <c:forEach begin="1" end="${lastCount}" step="1" varStatus="status">
                    <tr
                    <c:if test="${status.count%2==0}"> bgcolor="#ffffff"</c:if>
                    >
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    </tr>
                </c:forEach>
            </c:if>
        </table>
        <div class="paginationDiv">
            <ul class="pagination" id="pagination"></ul>
        </div>
    </div>
</shiro:hasPermission>

<div id="dialog" title="添加用户" class="window-inline">

</div>
<div id="loadDiv"></div>
</body>
</html>